<template>
  <div class="cdetails">
    <div class="block">
      <el-card class="box-card" :body-style="{backgroundColor: '#fafafa'}">
        <div slot="header" class="box-head">
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item class="c-text" :to="{ path: '/article' }">
              首页
            </el-breadcrumb-item>
            <el-breadcrumb-item class="c-text" :to="{ path: '/article/case' }">
              真实案例
            </el-breadcrumb-item>
            <el-breadcrumb-item class="c-text">
              {{ this.case.title }}
            </el-breadcrumb-item>
          </el-breadcrumb>
        </div>
        <div class="box-body">
          <div class="title">
            {{ this.case.title }}
          </div>
          <div class="name">
            {{this.name}}
          </div>
          <div class="time">
            {{ this.case.time }}
          </div>
          <el-divider content-position="left">
          </el-divider>
          <span class="con" ref="content" v-html='this.case.cont'></span>
        </div>
        <div style="height: 50px"></div>
      </el-card>
      <div style="height: 100px"></div>
    </div>
  </div>
</template>

<script>
import moment from "moment";
import axios from "axios";

export default {
  data : function() {
    return {
      case: {},
      name: '',
    }
  },
  mounted() {
    this.load();
  },
  methods: {
    load() {
      if(!sessionStorage.getItem("case"))
      {
        this.$message({
          showClose: true,
          type: "error",
          message: "文章信息读取失败！",
        })
        this.$router.push("/article/case")
      }

      this.case = JSON.parse(sessionStorage.getItem("case"))

      axios.get("api/user/info/byid", {
        params: {
          id: this.case.auid,
        }
      }).then((res) => {
        if (res.data.code === '0') {
          //console.log()
          this.name = res.data.data.name
        } else {
          this.$message({
            showClose: true,
            type: "error",
            message: "文章信息获取失败！",
          })
        }
      })
    }
  }
}
</script>

<style scoped>
.cdetails{
  width: 100%;
  min-height: 666px;
}

.block{
  width: 80%;
  position: relative;
  padding-top: 20px;
  left: 50%;
  transform: translate(-50%, 0%);
  /*box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);*/
}

.box-card{
  background-color: #354e66;
}

/deep/ .el-breadcrumb__inner {
  color: #f9bf4b !important;
  font-weight: bold !important;
}

.c-text {
  font-size: 17px;
  color: #f9bf4b;
}

.box-body {
  padding: 40px 100px;
  min-height: 200px;
  white-space: pre-wrap;
  text-align: left;
}

.title {
  font-size: 26px;
  font-weight: bold;
  padding-bottom: 40px;
  text-align: center;
}

.name {
  padding-bottom: 20px;
  font-size: 18px;
  text-align: center;
}

.time {
  text-align: right;
}

</style>